<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>留言板</title>
    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .message {
            width: 500px;
            height: 400px;
            border: 2px solid #ccc;
            margin: auto;
            position: relative;
            background-color: #000;
        }

        .message input {
            position: absolute;
            bottom: 0;
        }

        .message #text {
            left: 0;
            width: 380px;
            height: 60px;
            outline: none;
            padding: 0 20px;
            color: #fff;
            background-color: rgb(59, 57, 57);
            font-size: 23px;
            border: none;
        }

        .message #btn {
            right: 0;
            width: 80px;
            height: 60px;
            background-color: yellow;
            cursor: pointer;
            font-size: 20px;
            color: #000;
            font-weight: 600;
            border: none;
        }

        .message #btn:hover {
            background-color: skyblue;
            color: #fff;
        }

        .message li {
            margin: 20px 0 0 30px;
            color: #fff;
            font-size: 20px;
            list-style: none;
        }
    </style>
</head>

<body>
    <!-- 这里我们选择做一个完整好看的留言板 -->
    <div class="message">
        <input type="text" name="" id="text" placeholder="请输入评论内容">
        <input type="button" name="" id="btn" value="提交">
        <ul>
            <li>好好笑啊</li>
        </ul>
    </div>


    <script>
        var text = document.querySelector('#text');
        var btn = document.querySelector('#btn');
        var ul = document.querySelector('.message ul');
        btn.onclick = function () {
            if (text.value === '') {
                return;
            } else {
                var li = document.createElement('li');
                ul.appendChild(li);
                li.innerHTML = text.value;
                text.value = '';
            }
        }
        addEventListener
    </script>
</body>

</html>